<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>留言板~</title>
  <script src="__PUBLIC__/script/jquery/dist/jquery.min.js?v=1.0"></script>
  <script src="__PUBLIC__/script/jquery-weui/dist/js/swiper.min.js?v=1.0"></script>
  <script src="__PUBLIC__/script/jquery-weui/dist/js/jquery-weui.min.js?v=1.0"></script>
  <link rel="stylesheet" href="__PUBLIC__/script/jquery-weui/dist/css/jquery-weui.css?v=1.0">
  <link rel="stylesheet" href="__PUBLIC__/script/jquery-weui/dist/lib/weui.min.css?v=1.0">
  <link rel="stylesheet" href="__PUBLIC__/styles/base.css?v=1.0">
  <link rel="stylesheet" href="__PUBLIC__/styles/panel_chat1.css?v=1.0.1">
  <style>
    /* 收缩 */
    #panel_data:checked ~ .weui-cell {
      display: none;
    }
  </style>
  <script>
    window.from_user_group = `{$from_user_group}`
    window.chat_lccdc_data = `{$chat_lccdc_data}`
    const fromPHP = `{$from_user_group}`
    window.fromPHP = fromPHP
    sessionStorage.setItem('from_user_group_id', null)
    if (JSON.parse(window.fromPHP).from_user_group_id) {
      sessionStorage.setItem('from_user_group_id', JSON.parse(window.fromPHP).from_user_group_id)
    }
  </script>
</head>
<body>
  <div style="display:none;">
    <input type="hidden" id='getQudaoList' name="获取渠道列表" value="{:U('Chat/ajax_load_bank_list')}">
    <input type="hidden" id='getRoomID' name="聊天室id" value="{$Think.session.chat.chat_id}">
    <input type="hidden" id='postMessage' name="消息发送" value="{:U('Chat/send_msg')}">
    <input type="hidden" id='getMessage' name="消息拉取" value="{:U('Chat/update_record')} ">
  </div>
  <div class="container">
    <div class="messageContainer">
      <!-- 客户资料区域 -->
      <div class="weui-cells__title"><label for="panel_data" style="display:block;" id='panel_data_title'>点击收起</label></div>
      <div class="weui-cells panel_data" id='panel_data_container' style='font-size:0!important;transition:transform 0.1s;transform-origin:top;'>
        <input type="checkbox" name="不提交，仅用作收缩" id="panel_data">
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>标题文字1</p>
          </div>
          <div class="weui-cell__ft">说明文字1</div>
        </div>
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>标题文字2</p>
          </div>
          <div class="weui-cell__ft">说明文字2</div>
        </div>
      </div>
      <!-- end 客户资料区域 -->
      <volist name='record_data' id='vo'>
        <if condition="$vo.from_user neq $from_user_group_data['from_user_group_id']">
        <div class="messageBlock" inori-data-id='{$vo.record_id}'>
          <!-- logo就是logo了，内容是单字 -->
          <div class="person_logo">
            <!--
              main_qudao 评估令渠道
              alt_qudao 公司渠道
              common_qudao_name 共有渠道
              person-id 用来确认修改发送人的，值将会被直接用于表单数据，用于分辨传给谁 下同
             -->


          <div class="name common_qudao_name" person-id='1'>{$vo.web_name}</div>
          </div>
          <div class="message_main_block">
            <!-- 第一行是产品代码加地区,原始ID放在span里边我前端后期处理成随机，要求原始代码不能有字母，我用这个来判断是不是已经处理了 -->
            <div class="person_info"><span class="id">AA12345678</span> {$vo.web_city|re_data_web}</div>
            <!-- 第二行是额度加利息利率 -->
            <div class="person_info_from">{$vo.goods_id|get_min_ed}万-{$vo.goods_id|get_max_ed}万 <span> </span> {$vo.goods_id|get_min_lx}%-{$vo.goods_id|get_max_lx}%</div>
            <!-- 第三行是内容 -->
            <div class="message_content">{$vo.msg}</div>
            <!-- 时间，格式随意 -->
            <div class="message_time">{$vo.time}</div>
          </div>
        </div>
            <else />
          <div class="messageBlock">
           <div class="person_logo">
           <div class="name my_name"><if condition='$vo.role eq 1'>按<else />我</if></div>
           </div>
           <div class="message_main_block">
           <div class="person_name"><if condition='$vo.role eq 1'>按<else />我</if></div>
           <div class="person_name anjie_from">{$Think.session.user.p_u_id|get_web_f_mesage}</div>
           <div class="his_name" person-id='1'>{$vo.to_user|get_web_nickname}</div>
           <div class="message_content">{$vo.msg}</div>
           <div class="message_time">{$vo.time}</div>
           </div>
           </div>
        </if>
      </volist>


    </div>
    <div class="funcContainer" style="background-color: #fff;z-index:10;">
      <div class="person_logo" id='choseAnother'>
        <input type="text" name="message_person" value="" style="display:none;">
        <div class="send_to_person name common_qudao_name">+</div>
      </div>
      <div class="message_input_wrap" id='messageInput' contenteditable="true">
        <!-- <input type="text" name='message' class="message_input" value='你好这是我的一个客户'> -->
        你好，这是我的一个客户
      </div>
      <div class="send_btn_wrap">
        <input class="send_btn" id='sendMessage' type="button" value='发送'>
      </div>
      <!-- <div class="shutdown_btn_wrap"> -->
        <!-- <input class="shutdown_btn" id='shutdown' type="button" value='测试'> -->
        <!-- <input class="shutdown_btn" id='shutdown' type="button" value='关停'> -->
      <!-- </div> -->
      </div>
    </div>
  <div id="qudaoListPopup" class="weui-popup__container popup-bottom">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
      <div class="weui-cells" id='qudaoList'>
        <div class="weui-cell" class='qudaoListItem' inori-id=''>
          <div class="weui-cell__bd">
            <p>网络错误</p>
          </div>
          <div class="weui-cell__ft"> </div>
        </div>
      </div>
    </div>
  </div>

  <script src="__PUBLIC__/script/panel_chat1.js?v=1.0.3" defer></script>
  <script>
    // 收缩动作
    $('#panel_data').on('change', (evt) => {
      if ($('#panel_data').prop('checked')) {
        $('#panel_data_title').text(`点击展开`)
        $('#panel_data_container').css('transform', 'scaleY(0)')
      } else {
        $('#panel_data_title').text(`点击收起`)
        $('#panel_data_container').css('transform', 'scaleY(1)')
      }
    })
  </script>
  <script>
    $('#shutdown').on('click', (evt) => {
      evt.stopPropagation()
      evt.preventDefault()
      $.toptip(`正在拉取新消息。。。`, 'success')
      getNewMessage()
    })
  </script>
  <script>
    window.addEventListener('message', fromNav, false)
    function fromNav(event) {
      if (event.data.fetch) {
        $.toptip(event.data.fetch, 'success')
        if (event.data && event.data.fetch === 'true') {
          getNewMessage()
        }
      } else if (event.data.clickPerson && event.data.clickPerson === 'true') {
        $(`#choseAnother`).click()
      }
    }
  </script>
</body>
</html>